@extends('home.plate.layout')

@section('content')
    <div class="naver-main">
        <div class="layout">
            <!-- 20130909-导航-start -->
            <nav class="naver">
                <ul id="naver-list">
                    <li id="index">
                        <a class="current" href="{{ url('/home/index/index') }}">
                        <span>
                            首页
                        </span>
                        </a>
                    </li>
                    <li id="index">
                        <a class="current" href="{{ url('/home/plate/menuplate/1') }}">
                        <span>
                            新品上市专区
                        </span>
                        </a>
                    </li>
                    <li id="index">
                        <a class="current" href="{{ url('/home/plate/menuplate/2') }}">
                        <span>
                            降价特惠专区
                        </span>
                        </a>
                    </li>
                    <li id="index">
                        <a class="current" href="{{ url('/home/plate/menuplate/3') }}">
                        <span>
                            火爆销售专区
                        </span>
                        </a>
                    </li>
                </ul>
                <script>
                    $(function () {
                        $('#naver-list li').hover(function () {
                            $(this).addClass('hover');
                        }, function () {
                            $(this).removeClass('hover');
                        });

                    });
                </script>
            </nav><!-- 20130909-导航-end -->
            <!-- 20140823-分类-start -->
            <div class="category" id="category-block">
                <!-- 20140822-分类-start -->
                <div class="h">
                    <h2>全部商品</h2>
                    <i class="icon-category"></i>
                </div>
                <div class="b">
                    <ol class="category-list">
                        @foreach($allPlates as $k => $v)
                            <li class="category-item ">
                            <div class="category-info" style="overflow: hidden;height:40px">
                                <h3>
                                    <a target="_blank">
                                    <span>
                                        {{ $v -> platename }}
                                    </span>
                                    </a>
                                </h3>
                                @foreach($sonPlates as $key => $val)
                                    @if($val -> pid == $v -> id)
                                <a href="{{ url('/home/plate/smallPlate/') }}/{{ $val->id }}">
                                <span>
                                    {{ $val -> platename }}
                                </span>
                                </a>
                                    @endif
                                @endforeach
                            </div>
                            <div class="category-panels children-col-1">
                                <ul class="subcate-list children-col-list">
                                    @foreach($sonPlates as $key => $val)
                                        @if($val -> pid == $v -> id)
                                    <li class="subcate-item">
                                        <a href="{{ url('/home/plate/smallPlate') }}/{{ $val->id }}">
                                        <span>
                                            {{ $val -> platename }}
                                        </span>
                                        </a>
                                    </li>
                                        @endif
                                    @endforeach
                                </ul>
                            </div>
                        </li>
                        @endforeach
                    </ol>
                </div>
            </div>
            <!-- 20140822-分类-end -->

            <!-- 20140823-分类-end -->

        </div>
    </div>
    </div>
    <script>
        (function () {
            //所有分类显示隐藏控制
            var isIndex = false,
                categoryBlock = gid('category-block');

            if (isIndex) return;

            $("#category-block").hover(function () {
                $(this).addClass("category-hover");
            }, function () {
                $(this).removeClass("category-hover");
            });

            /*categoryBlock.onmouseover = function () {
             categoryBlock.className = 'category category-hover';
             };
             categoryBlock.onmouseout = function () {
             categoryBlock.className = 'category';
             };*/

        }());

        /**
         *功能：给鼠标移动到category-list li上面的时候，记得给他多添加一个hover类样式
         *目的是兼容ie6,以及调整二级分类的弹出框的位置。
         *@author 李峰
         */
        /**
         $(function(){
	$(".category-item").hover(function(){
		$(this).addClass("hover");
		//1.二级分类的top值
		var childrenTop = $(this).offset().top;
		//2.一级分类的top值
		var parentTop = $(".category-list").offset().top;
		//3.二级分类到一级分类顶部的距离
		var top = childrenTop - parentTop;
		//4.二级分类的弹出层的高度
		var childrenHeight = $(this).find(".category-panels").innerHeight();
		//5.一级分类容器的总高度
		var totalHeight = $(".category-list").height();
		alert("childrenTop:"+childrenTop+";parentTop:"+parentTop+";top:"+top+";childrenHeight:"+childrenHeight+";totalHeight:"+totalHeight) ;

		//6.如果二级分类.category-panels的内容高度大于总容量totalHeight,那么.category-panels置顶，然后多余的自动往下延续
		//如果二级分类childrenHeight内容高度(childrenHeight + top )大于totalHeight,那么.category-panels往上移动childrenHeight + top -totalHeight
		if((top + childrenHeight) > totalHeight)
		{
			if(childrenHeight > totalHeight)
			{
				$(this).find(".category-panels").css("top",-top);
			}else{
				//上移动
				var topX = (childrenHeight+top) - totalHeight;
				$(this).find(".category-panels").css("top",-topX);

			}

		}

	},function(){
		$(this).removeClass("hover");
	});
});
         */
    </script>
    <div class="hr-10"></div>
    <div class="g">
        <!--面包屑 -->
        <div class="breadcrumb-area fcn">
            <a href="{{ url('/home/index/index') }}" title="首页">首页</a>&nbsp;>&nbsp;&nbsp;
            <span>搜索结果</span>
        </div>
        <div class="hr-10"></div>


        <!--到货通知弹出框-->
        <textarea id="product-arrival-html" class="hide">
	<div class="arrival-remind-area">
		<ul class="clearfix">
			<li id="arrival-email">
				<p class="a-title">邮件通知</p>
				<p id="account-email" class="a-txt">xxxxxxxxxxxxxxxxxxxx@huawei.com</p>
				<s></s>
			</li>
			<li id="arrival-mobile">
				<p class="a-title">短信通知</p>
				<p id="account-mobile" class="a-txt">185&nbsp;6644&nbsp;5856</p>
				<s></s>
			</li>
		</ul>
	</div>
	<div class="box-custom-button">
		<input type="submit" class="box-ok box-button-style-1" value="提交"/>
	</div>
	<div id="arrival-error" class="box-form-tips hide">
		<span class="icon-error">输入有误</span>
	</div>
</textarea>
        <input id='sField' type='hidden' value='default'/>
        <input id='sType' type='hidden' value='desc'/>
        <script src="js/new_list.min.js"></script>
        <script>
            ec.load("ec.pager");
        </script>
        <!-- 20140726-频道-列表-start -->
        <div class="channel-list">
            <!-- 20140727-商品列表-start -->
            <div class="pro-list clearfix">
                <ul>
                    @foreach($data as $k => $v)
                        <li>
                            <div class="pro-panels">
                                <p class="p-img">
                                    <a target="_blank" href="{{ url('/home/goods/goodsDetail') }}/{{ $v->id }}"
                                       title="热卖中!!!买买买"><img alt=""src="{{ asset('/uploads/goodspic/147982869790480.jpg') }}"/></a>
                                </p>
                                <p class="p-name">
                                    <a target="_blank" href="{{ url('/home/goods/goodsDetail') }}/{{ $v->id }}"
                                       title="热卖中!!!买买买">{{ $v -> goodsname }}</a>
                                </p>
                                <p class="p-price"><b>&yen;{{ $v->price }}</b></p>
                                <div class="p-button clearfix">
                                    <table colspan="0" border="0" rowspan="0">
                                        <tbody>
                                        <tr>
                                            <td><a target="_blank" href="{{ url('/home/goods/goodsDetail') }}/{{ $v->id }}"
                                                   class="p-button-cart"><span>选购</span></a></td>
                                            <td><label class="p-button-score"><span>{{ $v->comment }}人评价</span></a></td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </li>
                    @endforeach
                </ul>
            </div>
            <!-- 20140727-商品列表-end -->
            <!-- 分页-start -->
            <div id="list-pager-75" class="pager">
		    <span class="hide">
			    <a href="/list-75-1" title="荣耀 第1页">第1页</a>&nbsp;&nbsp;
		    </span>
            </div>
        </div><!-- 20140726-频道-列表-end -->
        <!--弹出层-成功添加到购物车 -->
        <textarea id="cart-tips" class="hide">
<div class="pro-add-success" style="margin:-14px -30px 0;">
	<dl>
		<dt><s></s></dt>
		<dd>
			<div id="cart-briefName" class="pro-add-success-name">华为 Ascend P1 U9200 3G手机（晶钻黑）WCDMA</div>
			<div class="pro-add-success-msg">成功加入购物车!</div>
			<div class="pro-add-success-total">购物车中共&nbsp;<b id="cart-total">0</b>&nbsp;件商品，金额合计&nbsp;<b
                        id="cart-price">¥&nbsp;2699</b></div>
			<div class="pro-add-success-button"><a href="javascript:;" class="box-ok button-style-1 button-go-cart"
                                                   title="去购物车结算">去结算</a><a
                        class="box-cancel button-style-4 button-walking" href="javascript:;"
                        title="继续逛逛">继续逛逛&nbsp;>></a></div>
		</dd>
	</dl>
</div>
</textarea>
        <!-- 20131218-商品简介-弹出层-成功添加到购物车-end -->

        <!--弹出层-添加到购物车失败 -->
        <textarea id="popup-tips" class="hide">
    <!-- 20131230-商品简介-弹出层-添加到购物车失败-start -->
	<div class="pro-add-error" style="margin-top:-40px;">
		<i></i>
		<div id="popup-tips-msg" class="pro-add-error-msg">非常抱歉！该商品不能单独销售！</div>
		<div class="pro-add-error-button"><a href="javascript:;" title="知道了"
                                             class="box-cancel button-style-4 button-par-define">知道了</a></div>
	</div>
</textarea>
        <!-- 20131230-商品简介-弹出层-添加到购物车失败-end -->


        <form action="#" id="gotourl" method="get"></form>
        <script>
            //去结算
            ec.product.gotoshoppingCart = function () {
                //BI统计
                _paq.push(['trackLink', '加入购物车-去支付', 'link', ' ']);
                ec.code.addAnalytics({hicloud: true});
                setTimeout(function () {
                    //var url = '/order/shoppingCart';
                    var url = 'http://cart.vmall.com/cart/cart.html';
                    $('#gotourl').attr('action', url).submit();
                }, 500);
            };
        </script>
        <div class="hr-40"></div>
        <script>
            ec.ready(function () {
                //封装已选属性列表
                var attrList = [];
                ec.product.renderPage(75, attrList, $("#sField").val(), $("#sType").val(), {
                    pageNumber: 1,
                    totalPage: 1,
                    recordCount: 7
                });
            });

            /**
             *描述：当点击一级分类，在展现属性中，可能出在存在相同的属性名称。
             *所以现在暂时弥补的方法  当点击分类---"全部"的时候，隐藏下面属性的列
             *@lifeng
            */
            ec.ready(function () {
                var result = $("#first-category").attr("class");
                if (result == "selected") {
                    //把分类下面的属性全部隐藏
                    $(".pro-cate-area").find("div[id^='pro-cate-attr-']").hide();
                }
            })

        </script>
@endsection